<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>函数</title>
	</head>
	<body>
		<script type="text/javascript">
			
			// 封装重复性代码
			function cook(isBad) { // isBad形式参数
				alert(isBad);
				if(isBad){
					alert('order deliver dinner')
				}else{
					alert('cooking dinner');
				}
			}
			
			// var bad = true;
			var bad = false;
			// cook(bad);
			cook();
		</script>
	</body>
</html>


